<?php
    $ip = "127.0.0.1";
    class Server {
        function __construct($port,$serverName){
            $this->port = $port;
            $this->serverName = $serverName;
        }

        function getServerInfo(){
            $connection = @fsockopen($ip, $this->port,$errno,$errstr,100);
            $status = "offline";

            if($connection){
                $status = "online";
                fclose($connection);
            }
            echo $this->serverName.": ".$status."<br>";
        }

        function __destruct(){}
    }
    $serverArr = array(
        new Server(15000,"登录服务器"),
        new Server(9303,"新手/高手1服务器"),
        new Server(13002,"中频(测试用)服务器"),
        new Server(13004,"高手2服务器")
    );
    foreach ($serverArr as $key => $server) {
        $server->getServerInfo();
    }

 ?>